
<h1><span class="yiyi-st" id="yiyi-12">numpy.is_busday</span></h1>
        <blockquote>
        <p>原文：<a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.is_busday.html">https://docs.scipy.org/doc/numpy/reference/generated/numpy.is_busday.html</a></p>
        <p>译者：<a href="https://github.com/wizardforcel">飞龙</a> <a href="http://usyiyi.cn/">UsyiyiCN</a></p>
        <p>校对：（虚位以待）</p>
        </blockquote>
    
<dl class="function">
<dt id="numpy.is_busday"><span class="yiyi-st" id="yiyi-13"> <code class="descclassname">numpy.</code><code class="descname">is_busday</code><span class="sig-paren">(</span><em>dates</em>, <em>weekmask=&apos;1111100&apos;</em>, <em>holidays=None</em>, <em>busdaycal=None</em>, <em>out=None</em><span class="sig-paren">)</span></span></dt>
<dd><p><span class="yiyi-st" id="yiyi-14">计算哪些给定日期是有效日期，哪些日期不是。</span></p>
<div class="versionadded">
<p><span class="yiyi-st" id="yiyi-15"><span class="versionmodified">版本1.7.0中的新功能。</span></span></p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name">
<col class="field-body">
<tbody valign="top">
<tr class="field-odd field"><th class="field-name"><span class="yiyi-st" id="yiyi-16">参数：</span></th><td class="field-body"><p class="first"><span class="yiyi-st" id="yiyi-17"><strong>日期</strong>：array_like of datetime64 [D]</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-18">要处理的日期的数组。</span></p>
</div></blockquote>
<p><span class="yiyi-st" id="yiyi-19"><strong>weekmask</strong>：str或array_like of bool，可选</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-20">一个七元素数组，表示星期一到星期日是有效日期。</span><span class="yiyi-st" id="yiyi-21">可以指定为长度为七的列表或数组，如[1,1,1,1,1,0,0]；一个长度为七的字符串，如&apos;1111100&apos;；或像“星期二星期三星期三星期五”的字符串，由工作日的3个字符的缩写组成，可选地由空格分隔。</span><span class="yiyi-st" id="yiyi-22">有效的缩写是：周一周二周三周四周五周六周日</span></p>
</div></blockquote>
<p><span class="yiyi-st" id="yiyi-23"><strong>节假日</strong>：array_like of datetime64 [D]，可选</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-24">要视为无效日期的日期数组。</span><span class="yiyi-st" id="yiyi-25">它们可以以任何顺序指定，并且NaT（非一次性）日期被忽略。</span><span class="yiyi-st" id="yiyi-26">此列表以适用于快速计算有效天数的规范化形式保存。</span></p>
</div></blockquote>
<p><span class="yiyi-st" id="yiyi-27"><strong>busdaycal</strong>：busdaycalendar，可选</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-28">指定有效天数的<a class="reference internal" href="numpy.busdaycalendar.html#numpy.busdaycalendar" title="numpy.busdaycalendar"><code class="xref py py-obj docutils literal"><span class="pre">busdaycalendar</span></code></a>对象。</span><span class="yiyi-st" id="yiyi-29">如果提供此参数，则不能提供周期掩码和假日。</span></p>
</div></blockquote>
<p><span class="yiyi-st" id="yiyi-30"><strong>out</strong>：bool的数组，可选</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-31">如果提供，此数组将填充结果。</span></p>
</div></blockquote>
</td>
</tr>
<tr class="field-even field"><th class="field-name"><span class="yiyi-st" id="yiyi-32">返回：</span></th><td class="field-body"><p class="first"><span class="yiyi-st" id="yiyi-33"><strong>out</strong>：bool的数组</span></p>
<blockquote class="last">
<div><p><span class="yiyi-st" id="yiyi-34">与<code class="docutils literal"><span class="pre">dates</span></code>具有相同形状的数组，每个有效日包含True，每个无效日为False。</span></p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<div class="admonition seealso">
<p class="first admonition-title"><span class="yiyi-st" id="yiyi-35">也可以看看</span></p>
<dl class="last docutils">
<dt><span class="yiyi-st" id="yiyi-36"><a class="reference internal" href="numpy.busdaycalendar.html#numpy.busdaycalendar" title="numpy.busdaycalendar"><code class="xref py py-obj docutils literal"><span class="pre">busdaycalendar</span></code></a></span></dt>
<dd><span class="yiyi-st" id="yiyi-37">指定一组自定义有效天数的对象。</span></dd>
<dt><span class="yiyi-st" id="yiyi-38"><a class="reference internal" href="numpy.busday_offset.html#numpy.busday_offset" title="numpy.busday_offset"><code class="xref py py-obj docutils literal"><span class="pre">busday_offset</span></code></a></span></dt>
<dd><span class="yiyi-st" id="yiyi-39">应用在有效日计数的偏移量。</span></dd>
<dt><span class="yiyi-st" id="yiyi-40"><a class="reference internal" href="numpy.busday_count.html#numpy.busday_count" title="numpy.busday_count"><code class="xref py py-obj docutils literal"><span class="pre">busday_count</span></code></a></span></dt>
<dd><span class="yiyi-st" id="yiyi-41">计算半天开放日期范围内有多少有效天数。</span></dd>
</dl>
</div>
<p class="rubric"><span class="yiyi-st" id="yiyi-42">例子</span></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="c1"># The weekdays are Friday, Saturday, and Monday</span>
<span class="gp">... </span><span class="n">np</span><span class="o">.</span><span class="n">is_busday</span><span class="p">([</span><span class="s1">&apos;2011-07-01&apos;</span><span class="p">,</span> <span class="s1">&apos;2011-07-02&apos;</span><span class="p">,</span> <span class="s1">&apos;2011-07-18&apos;</span><span class="p">],</span>
<span class="gp">... </span>                <span class="n">holidays</span><span class="o">=</span><span class="p">[</span><span class="s1">&apos;2011-07-01&apos;</span><span class="p">,</span> <span class="s1">&apos;2011-07-04&apos;</span><span class="p">,</span> <span class="s1">&apos;2011-07-17&apos;</span><span class="p">])</span>
<span class="go">array([False, False,  True], dtype=&apos;bool&apos;)</span>
</pre></div>
</div>
</dd></dl>
